package com.dotflat.fin.domain;

import com.dotflat.rest.domain.AreableObjectBase;
import com.matt.domain.Product;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 *  收费计划
 */

@Data
@Entity
@Table(name="fin_product_solution", uniqueConstraints = {
        @UniqueConstraint(columnNames = {
                "areaId", "name"
        })
})
@EqualsAndHashCode(callSuper = true)
public class ProductSolution extends AreableObjectBase {
    // 收费方案名称 金额 启用状态 备注
    @Column(columnDefinition = "VARCHAR(32) COMMENT '方案名称'", nullable = false)
    private String name;

//    @Column(columnDefinition = "VARCHAR(32) COMMENT '收款账号id'")
//    private String payAccountId;

    @Column(columnDefinition = "VARCHAR(128) COMMENT '备注'", nullable = false)
    private String remark;

    @Column(columnDefinition = " bit(1) DEFAULT 0 COMMENT '启用' ", nullable = false)
    private Boolean enabled = true;

    @Column(columnDefinition = "decimal(12, 2) COMMENT '总价格'")
    private BigDecimal fullAmount = BigDecimal.ZERO;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "solution")
    @OrderBy("created DESC")
    private List<ProductSolutionItem> products;
}
